//2405.子字符串的最优划分
//https://leetcode.cn/problems/optimal-partition-of-string/
class Solution {
public:
    int partitionString(string s) {
        int ret = 0;
        int n = s.size();
        int l = 0,r = 0;
        int arr[26] = {0};
        while(r < n)
        {
            if(arr[s[r]-'a'])
            {
                l = r;
                memset(arr,0,26*4);
                ++ret;
            }
            ++arr[s[r++]-'a'];
        }

        return ret+1;
    }
};